package aad.storyboard.model;

import utils.ViewUtils;
import android.graphics.Rect;

public class ParticleAnimation extends EffectAnimation{

	private ParticleEffect explosion;
	private Rect container;
	private boolean start=true;
	
	public ParticleAnimation(int duration, int t) {
		super(duration, t);	
		container=new Rect();
		container.left=0;
		container.top=0;
		container.bottom=ViewUtils.screenHeight;
		container.right=ViewUtils.screenWidth;	
		
	}

	@Override
	public void animate() {
		if (start)
			{explosion.setAlpha(255);
			System.out.println("Setting alpha in ParticleAnimation");
			 start=false;
			}
		if (explosion.isAlive()) {
			explosion.update(container);
		}
		else graphicalObjects.remove(explosion);
	}

	
	public void setContainer(Rect container)
	{
		this.container=container;
	}
	
	@Override
	public void adjustParameters() {
				
	}	
	
	public void addGraphicalObject(ParticleEffect explosion)
	{
		this.explosion = explosion;
		this.graphicalObjects.add(explosion);
	}
	
	@Override
	public void undo()
	{
		
	}

}
